{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:28:52.480820Z",
     "start_time": "2020-11-17T13:28:52.471770Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "np.set_printoptions(precision=2)\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "from scipy import stats\n",
    "from collections import Counter\n",
    "\n",
    "sns.set_style('ticks')\n",
    "\n",
    "%matplotlib inline\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "import matplotlib as mpl\n",
    "mpl.rcParams['figure.dpi']= 300\n",
    "mpl.rc(\"savefig\", dpi=300)\n",
    "\n",
    "from scipy.special import xlogy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Read files and select drugs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:28:52.885476Z",
     "start_time": "2020-11-17T13:28:52.882987Z"
    }
   },
   "outputs": [],
   "source": [
    "ref_type = 'log2_median_ic50_hn' # log2_median_ic50_3f_hn | log2_median_ic50_hn\n",
    "model_name = 'RWEN' \n",
    "\n",
    "dosage_shifted = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:28:53.274440Z",
     "start_time": "2020-11-17T13:28:53.272018Z"
    }
   },
   "outputs": [],
   "source": [
    "norm_type = 'TPM'\n",
    "\n",
    "current_dir = '../result/HN_model/{}/'.format(norm_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:28:53.530472Z",
     "start_time": "2020-11-17T13:28:53.504521Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Drug Name</th>\n",
       "      <th>Synonyms</th>\n",
       "      <th>Target</th>\n",
       "      <th>Target Pathway</th>\n",
       "      <th>Selleckchem Cat#</th>\n",
       "      <th>CAS number</th>\n",
       "      <th>PubCHEM</th>\n",
       "      <th>Others</th>\n",
       "      <th>entropy</th>\n",
       "      <th>max_conc</th>\n",
       "      <th>...</th>\n",
       "      <th>median_ic50_9f</th>\n",
       "      <th>log2_median_ic50_9f</th>\n",
       "      <th>log2_median_ic50_hn</th>\n",
       "      <th>median_ic50_hn</th>\n",
       "      <th>median_ic50_3f_hn</th>\n",
       "      <th>log2_median_ic50_3f_hn</th>\n",
       "      <th>median_ic50_9f_hn</th>\n",
       "      <th>log2_median_ic50_9f_hn</th>\n",
       "      <th>num_sensitive</th>\n",
       "      <th>num_sensitive_hn</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Drug ID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1001</th>\n",
       "      <td>AICA Ribonucleotide</td>\n",
       "      <td>AICAR, N1-(b-D-Ribofuranosyl)-5-aminoimidazole...</td>\n",
       "      <td>AMPK agonist</td>\n",
       "      <td>Metabolism</td>\n",
       "      <td>S1802</td>\n",
       "      <td>2627-69-2</td>\n",
       "      <td>65110</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.034272</td>\n",
       "      <td>2000.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>206.748380</td>\n",
       "      <td>7.691732</td>\n",
       "      <td>9.939784</td>\n",
       "      <td>982.139588</td>\n",
       "      <td>327.379863</td>\n",
       "      <td>8.354822</td>\n",
       "      <td>109.126621</td>\n",
       "      <td>6.769859</td>\n",
       "      <td>476</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1003</th>\n",
       "      <td>Camptothecin</td>\n",
       "      <td>7-Ethyl-10-Hydroxy-Camptothecin, SN-38, Irinot...</td>\n",
       "      <td>TOP1</td>\n",
       "      <td>DNA replication</td>\n",
       "      <td>S1288</td>\n",
       "      <td>7689-03-4</td>\n",
       "      <td>104842</td>\n",
       "      <td>(SN-38, S4908, 86639-52-3) (Irinotecan, S1198,...</td>\n",
       "      <td>4.609530</td>\n",
       "      <td>0.1000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.002003</td>\n",
       "      <td>-8.963413</td>\n",
       "      <td>-7.587491</td>\n",
       "      <td>0.005199</td>\n",
       "      <td>0.001733</td>\n",
       "      <td>-9.172454</td>\n",
       "      <td>0.000578</td>\n",
       "      <td>-10.757416</td>\n",
       "      <td>688</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1004</th>\n",
       "      <td>Vinblastine</td>\n",
       "      <td>Velban</td>\n",
       "      <td>Microtubule destabiliser</td>\n",
       "      <td>Mitosis</td>\n",
       "      <td>S1248</td>\n",
       "      <td>143-67-9</td>\n",
       "      <td>6710780</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.297122</td>\n",
       "      <td>0.1000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.001599</td>\n",
       "      <td>-9.289051</td>\n",
       "      <td>-7.150982</td>\n",
       "      <td>0.007036</td>\n",
       "      <td>0.002345</td>\n",
       "      <td>-8.735945</td>\n",
       "      <td>0.000782</td>\n",
       "      <td>-10.320907</td>\n",
       "      <td>753</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1006</th>\n",
       "      <td>Cytarabine</td>\n",
       "      <td>Ara-Cytidine, Arabinosyl Cytosine, U-19920</td>\n",
       "      <td>Antimetabolite</td>\n",
       "      <td>DNA replication</td>\n",
       "      <td>S1648</td>\n",
       "      <td>147-94-4</td>\n",
       "      <td>6253</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.646594</td>\n",
       "      <td>2.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.163032</td>\n",
       "      <td>-2.616771</td>\n",
       "      <td>-1.342632</td>\n",
       "      <td>0.394301</td>\n",
       "      <td>0.131434</td>\n",
       "      <td>-2.927594</td>\n",
       "      <td>0.043811</td>\n",
       "      <td>-4.512557</td>\n",
       "      <td>508</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1007</th>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>RP-56976, Taxotere</td>\n",
       "      <td>Microtubule stabiliser</td>\n",
       "      <td>Mitosis</td>\n",
       "      <td>S1148</td>\n",
       "      <td>114977-28-5</td>\n",
       "      <td>148124</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.220984</td>\n",
       "      <td>0.0125</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000761</td>\n",
       "      <td>-10.358915</td>\n",
       "      <td>-9.792998</td>\n",
       "      <td>0.001127</td>\n",
       "      <td>0.000376</td>\n",
       "      <td>-11.377960</td>\n",
       "      <td>0.000125</td>\n",
       "      <td>-12.962923</td>\n",
       "      <td>584</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Drug Name  \\\n",
       "Drug ID                        \n",
       "1001     AICA Ribonucleotide   \n",
       "1003            Camptothecin   \n",
       "1004             Vinblastine   \n",
       "1006              Cytarabine   \n",
       "1007               Docetaxel   \n",
       "\n",
       "                                                  Synonyms  \\\n",
       "Drug ID                                                      \n",
       "1001     AICAR, N1-(b-D-Ribofuranosyl)-5-aminoimidazole...   \n",
       "1003     7-Ethyl-10-Hydroxy-Camptothecin, SN-38, Irinot...   \n",
       "1004                                                Velban   \n",
       "1006            Ara-Cytidine, Arabinosyl Cytosine, U-19920   \n",
       "1007                                    RP-56976, Taxotere   \n",
       "\n",
       "                           Target   Target Pathway Selleckchem Cat#  \\\n",
       "Drug ID                                                               \n",
       "1001                 AMPK agonist       Metabolism            S1802   \n",
       "1003                         TOP1  DNA replication            S1288   \n",
       "1004     Microtubule destabiliser          Mitosis            S1248   \n",
       "1006               Antimetabolite  DNA replication            S1648   \n",
       "1007       Microtubule stabiliser          Mitosis            S1148   \n",
       "\n",
       "          CAS number  PubCHEM  \\\n",
       "Drug ID                         \n",
       "1001       2627-69-2    65110   \n",
       "1003       7689-03-4   104842   \n",
       "1004        143-67-9  6710780   \n",
       "1006        147-94-4     6253   \n",
       "1007     114977-28-5   148124   \n",
       "\n",
       "                                                    Others   entropy  \\\n",
       "Drug ID                                                                \n",
       "1001                                                   NaN  6.034272   \n",
       "1003     (SN-38, S4908, 86639-52-3) (Irinotecan, S1198,...  4.609530   \n",
       "1004                                                   NaN  4.297122   \n",
       "1006                                                   NaN  6.646594   \n",
       "1007                                                   NaN  4.220984   \n",
       "\n",
       "          max_conc  ...  median_ic50_9f  log2_median_ic50_9f  \\\n",
       "Drug ID             ...                                        \n",
       "1001     2000.0000  ...      206.748380             7.691732   \n",
       "1003        0.1000  ...        0.002003            -8.963413   \n",
       "1004        0.1000  ...        0.001599            -9.289051   \n",
       "1006        2.0000  ...        0.163032            -2.616771   \n",
       "1007        0.0125  ...        0.000761           -10.358915   \n",
       "\n",
       "         log2_median_ic50_hn  median_ic50_hn  median_ic50_3f_hn  \\\n",
       "Drug ID                                                           \n",
       "1001                9.939784      982.139588         327.379863   \n",
       "1003               -7.587491        0.005199           0.001733   \n",
       "1004               -7.150982        0.007036           0.002345   \n",
       "1006               -1.342632        0.394301           0.131434   \n",
       "1007               -9.792998        0.001127           0.000376   \n",
       "\n",
       "         log2_median_ic50_3f_hn  median_ic50_9f_hn  log2_median_ic50_9f_hn  \\\n",
       "Drug ID                                                                      \n",
       "1001                   8.354822         109.126621                6.769859   \n",
       "1003                  -9.172454           0.000578              -10.757416   \n",
       "1004                  -8.735945           0.000782              -10.320907   \n",
       "1006                  -2.927594           0.043811               -4.512557   \n",
       "1007                 -11.377960           0.000125              -12.962923   \n",
       "\n",
       "         num_sensitive  num_sensitive_hn  \n",
       "Drug ID                                   \n",
       "1001               476                27  \n",
       "1003               688                30  \n",
       "1004               753                33  \n",
       "1006               508                25  \n",
       "1007               584                32  \n",
       "\n",
       "[5 rows x 27 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_info_df = pd.read_csv('../preprocessed_data/GDSC/hn_drug_stat.csv', index_col=0)\n",
    "drug_info_df.index = drug_info_df.index.astype(str)\n",
    "\n",
    "drug_id_name_dict = dict(zip(drug_info_df.index, drug_info_df['Drug Name'].values))\n",
    "\n",
    "drug_info_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:29:57.580851Z",
     "start_time": "2020-11-17T13:29:57.576404Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Docetaxel',\n",
       " 'Doxorubicin',\n",
       " 'Epothilone B',\n",
       " 'Gefitinib',\n",
       " 'Obatoclax Mesylate',\n",
       " 'PHA-793887',\n",
       " 'PI-103',\n",
       " 'Vorinostat']"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tested_drug_list = [1007, 133, 201, 1010] + [182, 301, 302] + [1012]\n",
    "[drug_id_name_dict[str(d)] for d in tested_drug_list]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:29:58.517559Z",
     "start_time": "2020-11-17T13:29:58.498114Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>drug_id</th>\n",
       "      <th>cluster</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_delta</th>\n",
       "      <th>delta</th>\n",
       "      <th>cluster_kill</th>\n",
       "      <th>kill</th>\n",
       "      <th>drug_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>133</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-2.8334341716821|-2.6720860912117|-3.778959838...</td>\n",
       "      <td>-3.028104</td>\n",
       "      <td>87.69637799287|86.437921582584|93.209818273866...</td>\n",
       "      <td>85.297489</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>201</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-4.0213711434516|-3.6385077224033|-3.038971912...</td>\n",
       "      <td>-3.319798</td>\n",
       "      <td>94.199124702299|92.56712528151|89.152897129961...</td>\n",
       "      <td>87.040929</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1010</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>1.8712695534725|1.0992860185533|3.087297545393...</td>\n",
       "      <td>2.176924</td>\n",
       "      <td>21.465935078167|31.821936069363|10.52739493194...</td>\n",
       "      <td>17.366424</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>182</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-1.690692592809|-1.3450796341807|-0.8269725475...</td>\n",
       "      <td>-1.173359</td>\n",
       "      <td>76.348806194752|71.754940580896|63.95043861070...</td>\n",
       "      <td>66.444651</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient drug_id      cluster  \\\n",
       "0   HN120    1007  D1|D2|G1|G2   \n",
       "1   HN120     133  D1|D2|G1|G2   \n",
       "2   HN120     201  D1|D2|G1|G2   \n",
       "3   HN120    1010  D1|D2|G1|G2   \n",
       "4   HN120     182  D1|D2|G1|G2   \n",
       "\n",
       "                                           cluster_p  \\\n",
       "0  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "1  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "2  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "3  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "4  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "\n",
       "                                       cluster_delta     delta  \\\n",
       "0  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "1  -2.8334341716821|-2.6720860912117|-3.778959838... -3.028104   \n",
       "2  -4.0213711434516|-3.6385077224033|-3.038971912... -3.319798   \n",
       "3  1.8712695534725|1.0992860185533|3.087297545393...  2.176924   \n",
       "4  -1.690692592809|-1.3450796341807|-0.8269725475... -1.173359   \n",
       "\n",
       "                                        cluster_kill       kill  \\\n",
       "0  49.012625383709|59.452863251762|40.87266962319...  44.327073   \n",
       "1  87.69637799287|86.437921582584|93.209818273866...  85.297489   \n",
       "2  94.199124702299|92.56712528151|89.152897129961...  87.040929   \n",
       "3  21.465935078167|31.821936069363|10.52739493194...  17.366424   \n",
       "4  76.348806194752|71.754940580896|63.95043861070...  66.444651   \n",
       "\n",
       "            drug_name  \n",
       "0           Docetaxel  \n",
       "1         Doxorubicin  \n",
       "2        Epothilone B  \n",
       "3           Gefitinib  \n",
       "4  Obatoclax Mesylate  "
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "if dosage_shifted:\n",
    "    single_drug_pred_df = pd.read_csv(current_dir + 'pred_drug_kill_{}_{}_shifted.csv'.format(ref_type, model_name))\n",
    "else:\n",
    "    single_drug_pred_df = pd.read_csv(current_dir + 'pred_drug_kill_{}_{}.csv'.format(ref_type, model_name))\n",
    "\n",
    "\n",
    "single_drug_pred_df.loc[:, 'drug_id'] = single_drug_pred_df.loc[:, 'drug_id'].values.astype(str)\n",
    "single_drug_pred_df.loc[:, 'drug_name'] = [drug_id_name_dict[d] for d in single_drug_pred_df.loc[:, 'drug_id'].values]\n",
    "\n",
    "patient_list = sorted(list(set(single_drug_pred_df['patient'])))\n",
    "# sel_drug_id_list = sorted(list(set(single_drug_pred_df['drug_id'])))\n",
    "\n",
    "single_drug_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:29:59.046244Z",
     "start_time": "2020-11-17T13:29:59.022210Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>drug_id</th>\n",
       "      <th>cluster</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_delta</th>\n",
       "      <th>delta</th>\n",
       "      <th>cluster_kill</th>\n",
       "      <th>kill</th>\n",
       "      <th>drug_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>133</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-2.8334341716821|-2.6720860912117|-3.778959838...</td>\n",
       "      <td>-3.028104</td>\n",
       "      <td>87.69637799287|86.437921582584|93.209818273866...</td>\n",
       "      <td>85.297489</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>201</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-4.0213711434516|-3.6385077224033|-3.038971912...</td>\n",
       "      <td>-3.319798</td>\n",
       "      <td>94.199124702299|92.56712528151|89.152897129961...</td>\n",
       "      <td>87.040929</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1010</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>1.8712695534725|1.0992860185533|3.087297545393...</td>\n",
       "      <td>2.176924</td>\n",
       "      <td>21.465935078167|31.821936069363|10.52739493194...</td>\n",
       "      <td>17.366424</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>182</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-1.690692592809|-1.3450796341807|-0.8269725475...</td>\n",
       "      <td>-1.173359</td>\n",
       "      <td>76.348806194752|71.754940580896|63.95043861070...</td>\n",
       "      <td>66.444651</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>HN120</td>\n",
       "      <td>301</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-1.5438814859345|-3.2564531480835|-3.508445283...</td>\n",
       "      <td>-2.726141</td>\n",
       "      <td>74.462298740991|90.526989849554|91.92254116809...</td>\n",
       "      <td>81.894659</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>HN120</td>\n",
       "      <td>302</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-2.9431734242158|-5.9272591669807|-5.722303936...</td>\n",
       "      <td>-4.379040</td>\n",
       "      <td>88.493859956725|98.383266503135|98.14105898102...</td>\n",
       "      <td>89.751533</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1012</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>-1.5582956426338|-1.3535012950427|-0.684705475...</td>\n",
       "      <td>-1.075217</td>\n",
       "      <td>74.651824912916|71.873099117706|61.64723300190...</td>\n",
       "      <td>65.000026</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>HN137</td>\n",
       "      <td>1007</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>0.79370397506051|1.2332333929925|1.36138879750...</td>\n",
       "      <td>0.556959</td>\n",
       "      <td>36.582875652674|29.8424353741|28.016510025631|...</td>\n",
       "      <td>39.870749</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>HN137</td>\n",
       "      <td>133</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-2.3211293510138|-3.0366930917662|-1.619429529...</td>\n",
       "      <td>-2.528622</td>\n",
       "      <td>83.325642371615|89.137612549776|75.44527042929...</td>\n",
       "      <td>83.764686</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>HN137</td>\n",
       "      <td>201</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-4.3883277345136|-4.5845898310562|-4.656018092...</td>\n",
       "      <td>-3.995390</td>\n",
       "      <td>95.44253154549|95.999007952804|96.184901134623...</td>\n",
       "      <td>92.503709</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>HN137</td>\n",
       "      <td>1010</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>1.0492447329588|1.4907345257355|1.979404000592...</td>\n",
       "      <td>1.905182</td>\n",
       "      <td>32.579167038043|26.244513394081|20.22939550584...</td>\n",
       "      <td>21.663847</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>HN137</td>\n",
       "      <td>182</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-0.99974048802222|0.18598378763662|0.309603262...</td>\n",
       "      <td>-0.818209</td>\n",
       "      <td>66.662669213596|46.781602488642|44.65547968658...</td>\n",
       "      <td>62.671726</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>HN137</td>\n",
       "      <td>301</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-1.2952627219447|1.590712225114|-0.43299429930...</td>\n",
       "      <td>-1.981389</td>\n",
       "      <td>71.049877681835|24.925348129826|57.44739973039...</td>\n",
       "      <td>73.826091</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>HN137</td>\n",
       "      <td>302</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-2.9119151382162|-1.1638299895523|-0.721319358...</td>\n",
       "      <td>-2.367143</td>\n",
       "      <td>88.271399091043|69.1407017213|62.2454743811|91...</td>\n",
       "      <td>79.539710</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>HN137</td>\n",
       "      <td>1012</td>\n",
       "      <td>E1|E2|E3|F1|F2|F3</td>\n",
       "      <td>0.34090909090909|0.085227272727273|0.073863636...</td>\n",
       "      <td>-1.6872029354269|-0.87869503278811|-0.94846424...</td>\n",
       "      <td>-1.255824</td>\n",
       "      <td>76.305100277761|64.772748292351|65.86817844533...</td>\n",
       "      <td>69.369561</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>HN148</td>\n",
       "      <td>1007</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>-0.19813431763799|0.43224533155949|0.120545666...</td>\n",
       "      <td>0.082054</td>\n",
       "      <td>53.428019724419|42.565291444729|47.912317244552</td>\n",
       "      <td>47.507315</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>HN148</td>\n",
       "      <td>133</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>-3.7463341266633|-3.7315192565285|-2.352143769...</td>\n",
       "      <td>-3.021715</td>\n",
       "      <td>93.065282794362|92.998715518616|83.622193782922</td>\n",
       "      <td>86.700671</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>HN148</td>\n",
       "      <td>201</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>-4.1453586146833|-3.4811728328732|-3.025976844...</td>\n",
       "      <td>-3.404991</td>\n",
       "      <td>94.651287670146|91.781063189907|89.065482394711</td>\n",
       "      <td>89.448763</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>HN148</td>\n",
       "      <td>1010</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>3.6077282972192|3.0087094766515|1.7560473266508</td>\n",
       "      <td>2.555909</td>\n",
       "      <td>7.5810053997229|11.051626753858|22.842970548</td>\n",
       "      <td>15.142230</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>HN148</td>\n",
       "      <td>182</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>1.1837779173098|0.54544201060332|-1.2290587552175</td>\n",
       "      <td>-0.081536</td>\n",
       "      <td>30.565067358649|40.659208974087|70.096945996074</td>\n",
       "      <td>50.140888</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>HN148</td>\n",
       "      <td>301</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>0.81466208939767|-1.3059187826706|-2.195417470...</td>\n",
       "      <td>-1.021541</td>\n",
       "      <td>36.246512229021|71.201568467848|82.079565440175</td>\n",
       "      <td>63.701191</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>HN148</td>\n",
       "      <td>302</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>-2.425160220715|-3.286212073307|-5.4809403139244</td>\n",
       "      <td>-3.953596</td>\n",
       "      <td>84.303597186352|90.702409428612|97.809942266892</td>\n",
       "      <td>90.000785</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>HN148</td>\n",
       "      <td>1012</td>\n",
       "      <td>C1|C2|H1</td>\n",
       "      <td>0.31351351351351|0.20540540540541|0.4594594594...</td>\n",
       "      <td>-1.577899830887|-1.8406069791167|-1.6573321983384</td>\n",
       "      <td>-1.634240</td>\n",
       "      <td>74.908097650698|78.173596412407|75.92871202555</td>\n",
       "      <td>74.428145</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>HN159</td>\n",
       "      <td>1007</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>1.6489127743534|1.8107909558916|1.6261155935483</td>\n",
       "      <td>1.648157</td>\n",
       "      <td>24.178112169536|22.181084666833|24.468976321739</td>\n",
       "      <td>23.658926</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>HN159</td>\n",
       "      <td>133</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-2.7139276941211|-3.0875402853474|-3.011509595...</td>\n",
       "      <td>-2.895115</td>\n",
       "      <td>86.774331456483|89.474189774705|88.967438294023</td>\n",
       "      <td>87.300012</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>HN159</td>\n",
       "      <td>201</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-1.8961878692381|-1.1046240833397|-0.975824693...</td>\n",
       "      <td>-1.280138</td>\n",
       "      <td>78.823803391628|68.258284928745|66.293253736069</td>\n",
       "      <td>69.840850</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>HN159</td>\n",
       "      <td>1010</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>3.2277869795358|3.7681210340761|3.7360005244686</td>\n",
       "      <td>3.535931</td>\n",
       "      <td>9.6447844446245|6.8378862967677|6.9810868224242</td>\n",
       "      <td>7.716264</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>HN159</td>\n",
       "      <td>182</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-1.1079748226517|-0.49950707797802|0.657113872...</td>\n",
       "      <td>-0.125636</td>\n",
       "      <td>68.308584877236|58.57035327584|38.805944042974</td>\n",
       "      <td>51.373158</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>HN159</td>\n",
       "      <td>301</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-3.0853716166269|0.36105588362178|-0.214770223...</td>\n",
       "      <td>-1.016337</td>\n",
       "      <td>89.460024347314|43.775830720578|53.714826394213</td>\n",
       "      <td>62.570856</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>HN159</td>\n",
       "      <td>302</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-5.443288666678|-3.6814039733421|-4.4663113894758</td>\n",
       "      <td>-4.577180</td>\n",
       "      <td>97.753334496561|92.769131421538|95.671962791641</td>\n",
       "      <td>94.647897</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>HN159</td>\n",
       "      <td>1012</td>\n",
       "      <td>I1|I2|K1</td>\n",
       "      <td>0.31736526946108|0.18562874251497|0.4850299401...</td>\n",
       "      <td>-1.1058022143199|-1.6961737529238|-1.470742128...</td>\n",
       "      <td>-1.379156</td>\n",
       "      <td>68.275975425386|76.417342108825|73.486365185784</td>\n",
       "      <td>71.496766</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>HN160</td>\n",
       "      <td>1007</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>1.1821939707698|0.55464712030801|1.8743419800305</td>\n",
       "      <td>1.034673</td>\n",
       "      <td>30.588373050042|40.505355801517|21.430055207669</td>\n",
       "      <td>33.209618</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>HN160</td>\n",
       "      <td>133</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>-3.0107696129976|-3.3073820903028|-2.230617125...</td>\n",
       "      <td>-3.006673</td>\n",
       "      <td>88.962402807547|90.825419874007|82.435639317301</td>\n",
       "      <td>88.671589</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>HN160</td>\n",
       "      <td>201</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>-1.490250756676|-0.64611572851111|-1.942586908...</td>\n",
       "      <td>-1.213805</td>\n",
       "      <td>73.748995316106|61.012871467064|79.355660888475</td>\n",
       "      <td>69.379541</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>HN160</td>\n",
       "      <td>1010</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>4.4440447994417|4.6940806700277|1.995878127088</td>\n",
       "      <td>4.148803</td>\n",
       "      <td>4.3923975519164|3.7194562159516|20.045752217391</td>\n",
       "      <td>6.664169</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>HN160</td>\n",
       "      <td>182</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>2.2107055019034|1.6643207498949|0.62001684264106</td>\n",
       "      <td>1.724834</td>\n",
       "      <td>17.765094769493|23.982863596902|39.418294398121</td>\n",
       "      <td>23.872987</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>HN160</td>\n",
       "      <td>301</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>5.4818152133721|-1.0873685278857|6.1905502104051</td>\n",
       "      <td>2.872318</td>\n",
       "      <td>2.1887590707362|67.998577465851|1.3506809934567</td>\n",
       "      <td>29.351071</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>HN160</td>\n",
       "      <td>302</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>2.4834343027427|-2.279778103442|0.34321661844031</td>\n",
       "      <td>0.158807</td>\n",
       "      <td>15.169279049775|82.923592297452|44.080401829425</td>\n",
       "      <td>47.986214</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>HN160</td>\n",
       "      <td>1012</td>\n",
       "      <td>B1|B2|L</td>\n",
       "      <td>0.42222222222222|0.41481481481481|0.1629629629...</td>\n",
       "      <td>-0.88878176438393|-0.56462165049337|-0.8654510...</td>\n",
       "      <td>-0.750513</td>\n",
       "      <td>64.932114748688|59.661146985897|64.562998866947</td>\n",
       "      <td>62.685487</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>HN182</td>\n",
       "      <td>1007</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>0.69998201535017|0.25281302117536|1.8743419800305</td>\n",
       "      <td>0.701909</td>\n",
       "      <td>38.102720137739|45.630260578849|21.430055207669</td>\n",
       "      <td>38.313811</td>\n",
       "      <td>Docetaxel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>HN182</td>\n",
       "      <td>133</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>-3.1732960266895|-1.7041406681258|-2.230617125...</td>\n",
       "      <td>-2.802020</td>\n",
       "      <td>90.021009903416|76.516714589749|82.435639317301</td>\n",
       "      <td>86.693202</td>\n",
       "      <td>Doxorubicin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>HN182</td>\n",
       "      <td>201</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>-1.4161305500003|-1.3551244015801|-1.942586908...</td>\n",
       "      <td>-1.445199</td>\n",
       "      <td>72.742297809287|71.895837200163|79.355660888475</td>\n",
       "      <td>73.091256</td>\n",
       "      <td>Epothilone B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>HN182</td>\n",
       "      <td>1010</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>3.3170103376555|2.9423334578235|1.995878127088</td>\n",
       "      <td>3.137324</td>\n",
       "      <td>9.1191197214381|11.512069671947|20.045752217391</td>\n",
       "      <td>10.462485</td>\n",
       "      <td>Gefitinib</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>HN182</td>\n",
       "      <td>182</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>0.4555256390361|0.5425631210646|0.62001684264106</td>\n",
       "      <td>0.486066</td>\n",
       "      <td>42.171275246572|40.70736421199|39.418294398121</td>\n",
       "      <td>41.658677</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>HN182</td>\n",
       "      <td>301</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>2.2604422059243|-0.071999113227118|6.190550210...</td>\n",
       "      <td>2.097822</td>\n",
       "      <td>17.267032110987|51.247390672482|1.3506809934567</td>\n",
       "      <td>22.887616</td>\n",
       "      <td>PHA-793887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>HN182</td>\n",
       "      <td>302</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>-2.0922676382996|-0.51148192769478|0.343216618...</td>\n",
       "      <td>-1.581003</td>\n",
       "      <td>81.003681614505|58.771620604048|44.080401829425</td>\n",
       "      <td>73.603232</td>\n",
       "      <td>PI-103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>HN182</td>\n",
       "      <td>1012</td>\n",
       "      <td>J1|J2|L</td>\n",
       "      <td>0.71910112359551|0.20224719101124|0.0786516853...</td>\n",
       "      <td>-1.7119416997633|-1.3113851991349|-0.865451070...</td>\n",
       "      <td>-1.564352</td>\n",
       "      <td>76.613736396225|71.279199848479|64.562998866947</td>\n",
       "      <td>74.587031</td>\n",
       "      <td>Vorinostat</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   patient drug_id            cluster  \\\n",
       "0    HN120    1007        D1|D2|G1|G2   \n",
       "1    HN120     133        D1|D2|G1|G2   \n",
       "2    HN120     201        D1|D2|G1|G2   \n",
       "3    HN120    1010        D1|D2|G1|G2   \n",
       "4    HN120     182        D1|D2|G1|G2   \n",
       "5    HN120     301        D1|D2|G1|G2   \n",
       "6    HN120     302        D1|D2|G1|G2   \n",
       "7    HN120    1012        D1|D2|G1|G2   \n",
       "8    HN137    1007  E1|E2|E3|F1|F2|F3   \n",
       "9    HN137     133  E1|E2|E3|F1|F2|F3   \n",
       "10   HN137     201  E1|E2|E3|F1|F2|F3   \n",
       "11   HN137    1010  E1|E2|E3|F1|F2|F3   \n",
       "12   HN137     182  E1|E2|E3|F1|F2|F3   \n",
       "13   HN137     301  E1|E2|E3|F1|F2|F3   \n",
       "14   HN137     302  E1|E2|E3|F1|F2|F3   \n",
       "15   HN137    1012  E1|E2|E3|F1|F2|F3   \n",
       "16   HN148    1007           C1|C2|H1   \n",
       "17   HN148     133           C1|C2|H1   \n",
       "18   HN148     201           C1|C2|H1   \n",
       "19   HN148    1010           C1|C2|H1   \n",
       "20   HN148     182           C1|C2|H1   \n",
       "21   HN148     301           C1|C2|H1   \n",
       "22   HN148     302           C1|C2|H1   \n",
       "23   HN148    1012           C1|C2|H1   \n",
       "24   HN159    1007           I1|I2|K1   \n",
       "25   HN159     133           I1|I2|K1   \n",
       "26   HN159     201           I1|I2|K1   \n",
       "27   HN159    1010           I1|I2|K1   \n",
       "28   HN159     182           I1|I2|K1   \n",
       "29   HN159     301           I1|I2|K1   \n",
       "30   HN159     302           I1|I2|K1   \n",
       "31   HN159    1012           I1|I2|K1   \n",
       "32   HN160    1007            B1|B2|L   \n",
       "33   HN160     133            B1|B2|L   \n",
       "34   HN160     201            B1|B2|L   \n",
       "35   HN160    1010            B1|B2|L   \n",
       "36   HN160     182            B1|B2|L   \n",
       "37   HN160     301            B1|B2|L   \n",
       "38   HN160     302            B1|B2|L   \n",
       "39   HN160    1012            B1|B2|L   \n",
       "40   HN182    1007            J1|J2|L   \n",
       "41   HN182     133            J1|J2|L   \n",
       "42   HN182     201            J1|J2|L   \n",
       "43   HN182    1010            J1|J2|L   \n",
       "44   HN182     182            J1|J2|L   \n",
       "45   HN182     301            J1|J2|L   \n",
       "46   HN182     302            J1|J2|L   \n",
       "47   HN182    1012            J1|J2|L   \n",
       "\n",
       "                                            cluster_p  \\\n",
       "0   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "1   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "2   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "3   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "4   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "5   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "6   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "7   0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "8   0.34090909090909|0.085227272727273|0.073863636...   \n",
       "9   0.34090909090909|0.085227272727273|0.073863636...   \n",
       "10  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "11  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "12  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "13  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "14  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "15  0.34090909090909|0.085227272727273|0.073863636...   \n",
       "16  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "17  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "18  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "19  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "20  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "21  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "22  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "23  0.31351351351351|0.20540540540541|0.4594594594...   \n",
       "24  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "25  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "26  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "27  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "28  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "29  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "30  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "31  0.31736526946108|0.18562874251497|0.4850299401...   \n",
       "32  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "33  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "34  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "35  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "36  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "37  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "38  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "39  0.42222222222222|0.41481481481481|0.1629629629...   \n",
       "40  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "41  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "42  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "43  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "44  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "45  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "46  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "47  0.71910112359551|0.20224719101124|0.0786516853...   \n",
       "\n",
       "                                        cluster_delta     delta  \\\n",
       "0   0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "1   -2.8334341716821|-2.6720860912117|-3.778959838... -3.028104   \n",
       "2   -4.0213711434516|-3.6385077224033|-3.038971912... -3.319798   \n",
       "3   1.8712695534725|1.0992860185533|3.087297545393...  2.176924   \n",
       "4   -1.690692592809|-1.3450796341807|-0.8269725475... -1.173359   \n",
       "5   -1.5438814859345|-3.2564531480835|-3.508445283... -2.726141   \n",
       "6   -2.9431734242158|-5.9272591669807|-5.722303936... -4.379040   \n",
       "7   -1.5582956426338|-1.3535012950427|-0.684705475... -1.075217   \n",
       "8   0.79370397506051|1.2332333929925|1.36138879750...  0.556959   \n",
       "9   -2.3211293510138|-3.0366930917662|-1.619429529... -2.528622   \n",
       "10  -4.3883277345136|-4.5845898310562|-4.656018092... -3.995390   \n",
       "11  1.0492447329588|1.4907345257355|1.979404000592...  1.905182   \n",
       "12  -0.99974048802222|0.18598378763662|0.309603262... -0.818209   \n",
       "13  -1.2952627219447|1.590712225114|-0.43299429930... -1.981389   \n",
       "14  -2.9119151382162|-1.1638299895523|-0.721319358... -2.367143   \n",
       "15  -1.6872029354269|-0.87869503278811|-0.94846424... -1.255824   \n",
       "16  -0.19813431763799|0.43224533155949|0.120545666...  0.082054   \n",
       "17  -3.7463341266633|-3.7315192565285|-2.352143769... -3.021715   \n",
       "18  -4.1453586146833|-3.4811728328732|-3.025976844... -3.404991   \n",
       "19    3.6077282972192|3.0087094766515|1.7560473266508  2.555909   \n",
       "20  1.1837779173098|0.54544201060332|-1.2290587552175 -0.081536   \n",
       "21  0.81466208939767|-1.3059187826706|-2.195417470... -1.021541   \n",
       "22   -2.425160220715|-3.286212073307|-5.4809403139244 -3.953596   \n",
       "23  -1.577899830887|-1.8406069791167|-1.6573321983384 -1.634240   \n",
       "24    1.6489127743534|1.8107909558916|1.6261155935483  1.648157   \n",
       "25  -2.7139276941211|-3.0875402853474|-3.011509595... -2.895115   \n",
       "26  -1.8961878692381|-1.1046240833397|-0.975824693... -1.280138   \n",
       "27    3.2277869795358|3.7681210340761|3.7360005244686  3.535931   \n",
       "28  -1.1079748226517|-0.49950707797802|0.657113872... -0.125636   \n",
       "29  -3.0853716166269|0.36105588362178|-0.214770223... -1.016337   \n",
       "30  -5.443288666678|-3.6814039733421|-4.4663113894758 -4.577180   \n",
       "31  -1.1058022143199|-1.6961737529238|-1.470742128... -1.379156   \n",
       "32   1.1821939707698|0.55464712030801|1.8743419800305  1.034673   \n",
       "33  -3.0107696129976|-3.3073820903028|-2.230617125... -3.006673   \n",
       "34  -1.490250756676|-0.64611572851111|-1.942586908... -1.213805   \n",
       "35     4.4440447994417|4.6940806700277|1.995878127088  4.148803   \n",
       "36   2.2107055019034|1.6643207498949|0.62001684264106  1.724834   \n",
       "37   5.4818152133721|-1.0873685278857|6.1905502104051  2.872318   \n",
       "38   2.4834343027427|-2.279778103442|0.34321661844031  0.158807   \n",
       "39  -0.88878176438393|-0.56462165049337|-0.8654510... -0.750513   \n",
       "40  0.69998201535017|0.25281302117536|1.8743419800305  0.701909   \n",
       "41  -3.1732960266895|-1.7041406681258|-2.230617125... -2.802020   \n",
       "42  -1.4161305500003|-1.3551244015801|-1.942586908... -1.445199   \n",
       "43     3.3170103376555|2.9423334578235|1.995878127088  3.137324   \n",
       "44   0.4555256390361|0.5425631210646|0.62001684264106  0.486066   \n",
       "45  2.2604422059243|-0.071999113227118|6.190550210...  2.097822   \n",
       "46  -2.0922676382996|-0.51148192769478|0.343216618... -1.581003   \n",
       "47  -1.7119416997633|-1.3113851991349|-0.865451070... -1.564352   \n",
       "\n",
       "                                         cluster_kill       kill  \\\n",
       "0   49.012625383709|59.452863251762|40.87266962319...  44.327073   \n",
       "1   87.69637799287|86.437921582584|93.209818273866...  85.297489   \n",
       "2   94.199124702299|92.56712528151|89.152897129961...  87.040929   \n",
       "3   21.465935078167|31.821936069363|10.52739493194...  17.366424   \n",
       "4   76.348806194752|71.754940580896|63.95043861070...  66.444651   \n",
       "5   74.462298740991|90.526989849554|91.92254116809...  81.894659   \n",
       "6   88.493859956725|98.383266503135|98.14105898102...  89.751533   \n",
       "7   74.651824912916|71.873099117706|61.64723300190...  65.000026   \n",
       "8   36.582875652674|29.8424353741|28.016510025631|...  39.870749   \n",
       "9   83.325642371615|89.137612549776|75.44527042929...  83.764686   \n",
       "10  95.44253154549|95.999007952804|96.184901134623...  92.503709   \n",
       "11  32.579167038043|26.244513394081|20.22939550584...  21.663847   \n",
       "12  66.662669213596|46.781602488642|44.65547968658...  62.671726   \n",
       "13  71.049877681835|24.925348129826|57.44739973039...  73.826091   \n",
       "14  88.271399091043|69.1407017213|62.2454743811|91...  79.539710   \n",
       "15  76.305100277761|64.772748292351|65.86817844533...  69.369561   \n",
       "16    53.428019724419|42.565291444729|47.912317244552  47.507315   \n",
       "17    93.065282794362|92.998715518616|83.622193782922  86.700671   \n",
       "18    94.651287670146|91.781063189907|89.065482394711  89.448763   \n",
       "19       7.5810053997229|11.051626753858|22.842970548  15.142230   \n",
       "20    30.565067358649|40.659208974087|70.096945996074  50.140888   \n",
       "21    36.246512229021|71.201568467848|82.079565440175  63.701191   \n",
       "22    84.303597186352|90.702409428612|97.809942266892  90.000785   \n",
       "23     74.908097650698|78.173596412407|75.92871202555  74.428145   \n",
       "24    24.178112169536|22.181084666833|24.468976321739  23.658926   \n",
       "25    86.774331456483|89.474189774705|88.967438294023  87.300012   \n",
       "26    78.823803391628|68.258284928745|66.293253736069  69.840850   \n",
       "27    9.6447844446245|6.8378862967677|6.9810868224242   7.716264   \n",
       "28     68.308584877236|58.57035327584|38.805944042974  51.373158   \n",
       "29    89.460024347314|43.775830720578|53.714826394213  62.570856   \n",
       "30    97.753334496561|92.769131421538|95.671962791641  94.647897   \n",
       "31    68.275975425386|76.417342108825|73.486365185784  71.496766   \n",
       "32    30.588373050042|40.505355801517|21.430055207669  33.209618   \n",
       "33    88.962402807547|90.825419874007|82.435639317301  88.671589   \n",
       "34    73.748995316106|61.012871467064|79.355660888475  69.379541   \n",
       "35    4.3923975519164|3.7194562159516|20.045752217391   6.664169   \n",
       "36    17.765094769493|23.982863596902|39.418294398121  23.872987   \n",
       "37    2.1887590707362|67.998577465851|1.3506809934567  29.351071   \n",
       "38    15.169279049775|82.923592297452|44.080401829425  47.986214   \n",
       "39    64.932114748688|59.661146985897|64.562998866947  62.685487   \n",
       "40    38.102720137739|45.630260578849|21.430055207669  38.313811   \n",
       "41    90.021009903416|76.516714589749|82.435639317301  86.693202   \n",
       "42    72.742297809287|71.895837200163|79.355660888475  73.091256   \n",
       "43    9.1191197214381|11.512069671947|20.045752217391  10.462485   \n",
       "44     42.171275246572|40.70736421199|39.418294398121  41.658677   \n",
       "45    17.267032110987|51.247390672482|1.3506809934567  22.887616   \n",
       "46    81.003681614505|58.771620604048|44.080401829425  73.603232   \n",
       "47    76.613736396225|71.279199848479|64.562998866947  74.587031   \n",
       "\n",
       "             drug_name  \n",
       "0            Docetaxel  \n",
       "1          Doxorubicin  \n",
       "2         Epothilone B  \n",
       "3            Gefitinib  \n",
       "4   Obatoclax Mesylate  \n",
       "5           PHA-793887  \n",
       "6               PI-103  \n",
       "7           Vorinostat  \n",
       "8            Docetaxel  \n",
       "9          Doxorubicin  \n",
       "10        Epothilone B  \n",
       "11           Gefitinib  \n",
       "12  Obatoclax Mesylate  \n",
       "13          PHA-793887  \n",
       "14              PI-103  \n",
       "15          Vorinostat  \n",
       "16           Docetaxel  \n",
       "17         Doxorubicin  \n",
       "18        Epothilone B  \n",
       "19           Gefitinib  \n",
       "20  Obatoclax Mesylate  \n",
       "21          PHA-793887  \n",
       "22              PI-103  \n",
       "23          Vorinostat  \n",
       "24           Docetaxel  \n",
       "25         Doxorubicin  \n",
       "26        Epothilone B  \n",
       "27           Gefitinib  \n",
       "28  Obatoclax Mesylate  \n",
       "29          PHA-793887  \n",
       "30              PI-103  \n",
       "31          Vorinostat  \n",
       "32           Docetaxel  \n",
       "33         Doxorubicin  \n",
       "34        Epothilone B  \n",
       "35           Gefitinib  \n",
       "36  Obatoclax Mesylate  \n",
       "37          PHA-793887  \n",
       "38              PI-103  \n",
       "39          Vorinostat  \n",
       "40           Docetaxel  \n",
       "41         Doxorubicin  \n",
       "42        Epothilone B  \n",
       "43           Gefitinib  \n",
       "44  Obatoclax Mesylate  \n",
       "45          PHA-793887  \n",
       "46              PI-103  \n",
       "47          Vorinostat  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "single_drug_pred_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### List all drug pairs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:00.033541Z",
     "start_time": "2020-11-17T13:30:00.022251Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(168, 3)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>1010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>182</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>301</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B\n",
       "0   HN120  1007   133\n",
       "1   HN120  1007   201\n",
       "2   HN120  1007  1010\n",
       "3   HN120  1007   182\n",
       "4   HN120  1007   301"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_list = []\n",
    "n_drugs = len(tested_drug_list)\n",
    "\n",
    "for p in patient_list:\n",
    "    for x in range(0, n_drugs-1):\n",
    "        for y in range(x+1, n_drugs):\n",
    "            drug_x = str(tested_drug_list[x])\n",
    "            drug_y = str(tested_drug_list[y])\n",
    "\n",
    "            drug_combi_list += [[p, drug_x, drug_y]]\n",
    "\n",
    "drug_combi_df = pd.DataFrame(drug_combi_list, columns=['patient', 'A', 'B'])\n",
    "\n",
    "print (drug_combi_df.shape)\n",
    "drug_combi_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Get pred and info for each drug"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:00.911191Z",
     "start_time": "2020-11-17T13:30:00.897738Z"
    }
   },
   "outputs": [],
   "source": [
    "merge_df = pd.merge(drug_combi_df, single_drug_pred_df, how='left', left_on=['patient', 'A'], right_on=['patient', 'drug_id'])\n",
    "drug_combi_pred_df = pd.merge(merge_df, single_drug_pred_df[['patient', 'drug_id', 'drug_name', 'cluster_delta', 'delta', 'cluster_kill', 'kill']], how='left', left_on=['patient', 'B'], right_on=['patient', 'drug_id'], suffixes=['_A', '_B'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:01.240902Z",
     "start_time": "2020-11-17T13:30:01.220456Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>cluster</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_delta_A</th>\n",
       "      <th>delta_A</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>drug_name_A</th>\n",
       "      <th>drug_id_B</th>\n",
       "      <th>drug_name_B</th>\n",
       "      <th>cluster_delta_B</th>\n",
       "      <th>delta_B</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>kill_B</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>133</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>133</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>-2.8334341716821|-2.6720860912117|-3.778959838...</td>\n",
       "      <td>-3.028104</td>\n",
       "      <td>87.69637799287|86.437921582584|93.209818273866...</td>\n",
       "      <td>85.297489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>201</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>201</td>\n",
       "      <td>Epothilone B</td>\n",
       "      <td>-4.0213711434516|-3.6385077224033|-3.038971912...</td>\n",
       "      <td>-3.319798</td>\n",
       "      <td>94.199124702299|92.56712528151|89.152897129961...</td>\n",
       "      <td>87.040929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>1010</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>1010</td>\n",
       "      <td>Gefitinib</td>\n",
       "      <td>1.8712695534725|1.0992860185533|3.087297545393...</td>\n",
       "      <td>2.176924</td>\n",
       "      <td>21.465935078167|31.821936069363|10.52739493194...</td>\n",
       "      <td>17.366424</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>182</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>182</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "      <td>-1.690692592809|-1.3450796341807|-0.8269725475...</td>\n",
       "      <td>-1.173359</td>\n",
       "      <td>76.348806194752|71.754940580896|63.95043861070...</td>\n",
       "      <td>66.444651</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>301</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>301</td>\n",
       "      <td>PHA-793887</td>\n",
       "      <td>-1.5438814859345|-3.2564531480835|-3.508445283...</td>\n",
       "      <td>-2.726141</td>\n",
       "      <td>74.462298740991|90.526989849554|91.92254116809...</td>\n",
       "      <td>81.894659</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B drug_id_A      cluster  \\\n",
       "0   HN120  1007   133      1007  D1|D2|G1|G2   \n",
       "1   HN120  1007   201      1007  D1|D2|G1|G2   \n",
       "2   HN120  1007  1010      1007  D1|D2|G1|G2   \n",
       "3   HN120  1007   182      1007  D1|D2|G1|G2   \n",
       "4   HN120  1007   301      1007  D1|D2|G1|G2   \n",
       "\n",
       "                                           cluster_p  \\\n",
       "0  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "1  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "2  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "3  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "4  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "\n",
       "                                     cluster_delta_A   delta_A  \\\n",
       "0  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "1  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "2  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "3  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "4  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "\n",
       "                                      cluster_kill_A     kill_A drug_name_A  \\\n",
       "0  49.012625383709|59.452863251762|40.87266962319...  44.327073   Docetaxel   \n",
       "1  49.012625383709|59.452863251762|40.87266962319...  44.327073   Docetaxel   \n",
       "2  49.012625383709|59.452863251762|40.87266962319...  44.327073   Docetaxel   \n",
       "3  49.012625383709|59.452863251762|40.87266962319...  44.327073   Docetaxel   \n",
       "4  49.012625383709|59.452863251762|40.87266962319...  44.327073   Docetaxel   \n",
       "\n",
       "  drug_id_B         drug_name_B  \\\n",
       "0       133         Doxorubicin   \n",
       "1       201        Epothilone B   \n",
       "2      1010           Gefitinib   \n",
       "3       182  Obatoclax Mesylate   \n",
       "4       301          PHA-793887   \n",
       "\n",
       "                                     cluster_delta_B   delta_B  \\\n",
       "0  -2.8334341716821|-2.6720860912117|-3.778959838... -3.028104   \n",
       "1  -4.0213711434516|-3.6385077224033|-3.038971912... -3.319798   \n",
       "2  1.8712695534725|1.0992860185533|3.087297545393...  2.176924   \n",
       "3  -1.690692592809|-1.3450796341807|-0.8269725475... -1.173359   \n",
       "4  -1.5438814859345|-3.2564531480835|-3.508445283... -2.726141   \n",
       "\n",
       "                                      cluster_kill_B     kill_B  \n",
       "0  87.69637799287|86.437921582584|93.209818273866...  85.297489  \n",
       "1  94.199124702299|92.56712528151|89.152897129961...  87.040929  \n",
       "2  21.465935078167|31.821936069363|10.52739493194...  17.366424  \n",
       "3  76.348806194752|71.754940580896|63.95043861070...  66.444651  \n",
       "4  74.462298740991|90.526989849554|91.92254116809...  81.894659  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:01.845098Z",
     "start_time": "2020-11-17T13:30:01.792310Z"
    }
   },
   "outputs": [],
   "source": [
    "rows = []\n",
    "for _, data in drug_combi_pred_df.iterrows():\n",
    "    \n",
    "    cluster_p = np.array([float(p) for p in data['cluster_p'].split('|')])\n",
    "    \n",
    "    cluster_kill_A = np.array([float(k) for k in data['cluster_kill_A'].split('|')])\n",
    "    cluster_kill_B = np.array([float(k) for k in data['cluster_kill_B'].split('|')])\n",
    "    \n",
    "    cluster_kill_C = cluster_kill_A + cluster_kill_B - np.multiply(cluster_kill_A/100, cluster_kill_B/100)*100\n",
    "    kill_C = np.sum(cluster_p * cluster_kill_C)\n",
    "    \n",
    "    best_kill = np.max([data['kill_A'], data['kill_B']])\n",
    "    improve = kill_C - best_kill\n",
    "    improve_p = (kill_C - best_kill) / best_kill\n",
    "    \n",
    "    ##### specificity (entropy) #####\n",
    "    \n",
    "    temp_A = np.sum(cluster_p[cluster_kill_A > cluster_kill_B])\n",
    "    temp_B = np.sum(cluster_p[cluster_kill_A <= cluster_kill_B])\n",
    "    if temp_A == 0 or temp_B == 0:\n",
    "        entropy = 0\n",
    "    else:\n",
    "        entropy = -(temp_A * np.log2(temp_A) + temp_B * np.log2(temp_B))\n",
    "    \n",
    "    sum_kill_dif = np.sum(np.abs(cluster_kill_A - cluster_kill_B))\n",
    "    \n",
    "    ##### save output #####\n",
    "    \n",
    "    rows += [['|'.join([\"{:.14}\".format(k) for k in cluster_kill_C])] + [kill_C, improve, improve_p, entropy, sum_kill_dif]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:02.474607Z",
     "start_time": "2020-11-17T13:30:02.445240Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>cluster</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_delta_A</th>\n",
       "      <th>delta_A</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>...</th>\n",
       "      <th>cluster_delta_B</th>\n",
       "      <th>delta_B</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>kill_B</th>\n",
       "      <th>cluster_kill_C</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>kill_entropy</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>133</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.8334341716821|-2.6720860912117|-3.778959838...</td>\n",
       "      <td>-3.028104</td>\n",
       "      <td>87.69637799287|86.437921582584|93.209818273866...</td>\n",
       "      <td>85.297489</td>\n",
       "      <td>93.726706155852|94.500965518187|95.98514681760...</td>\n",
       "      <td>90.008341</td>\n",
       "      <td>4.710851</td>\n",
       "      <td>0.055228</td>\n",
       "      <td>0.0</td>\n",
       "      <td>169.970362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>201</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.0213711434516|-3.6385077224033|-3.038971912...</td>\n",
       "      <td>-3.319798</td>\n",
       "      <td>94.199124702299|92.56712528151|89.152897129961...</td>\n",
       "      <td>87.040929</td>\n",
       "      <td>97.042285980937|96.986182123569|93.58639764972...</td>\n",
       "      <td>90.673498</td>\n",
       "      <td>3.632569</td>\n",
       "      <td>0.041734</td>\n",
       "      <td>0.0</td>\n",
       "      <td>178.638303</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>1010</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>...</td>\n",
       "      <td>1.8712695534725|1.0992860185533|3.087297545393...</td>\n",
       "      <td>2.176924</td>\n",
       "      <td>21.465935078167|31.821936069363|10.52739493194...</td>\n",
       "      <td>17.366424</td>\n",
       "      <td>59.957542116904|72.355747185743|47.09723720467...</td>\n",
       "      <td>53.049766</td>\n",
       "      <td>8.722693</td>\n",
       "      <td>0.196780</td>\n",
       "      <td>0.0</td>\n",
       "      <td>111.481073</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>182</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.690692592809|-1.3450796341807|-0.8269725475...</td>\n",
       "      <td>-1.173359</td>\n",
       "      <td>76.348806194752|71.754940580896|63.95043861070...</td>\n",
       "      <td>66.444651</td>\n",
       "      <td>87.940877213293|88.547437132715|78.68485673796...</td>\n",
       "      <td>79.552638</td>\n",
       "      <td>13.107986</td>\n",
       "      <td>0.197277</td>\n",
       "      <td>0.0</td>\n",
       "      <td>91.931882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>301</td>\n",
       "      <td>1007</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>0.056986626834624|-0.5521462503121|0.532688663...</td>\n",
       "      <td>0.187198</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.5438814859345|-3.2564531480835|-3.508445283...</td>\n",
       "      <td>-2.726141</td>\n",
       "      <td>74.462298740991|90.526989849554|91.92254116809...</td>\n",
       "      <td>81.894659</td>\n",
       "      <td>86.97899659068|96.158965620124|95.224014230406...</td>\n",
       "      <td>88.213137</td>\n",
       "      <td>6.318478</td>\n",
       "      <td>0.077154</td>\n",
       "      <td>0.0</td>\n",
       "      <td>163.355724</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient     A     B drug_id_A      cluster  \\\n",
       "0   HN120  1007   133      1007  D1|D2|G1|G2   \n",
       "1   HN120  1007   201      1007  D1|D2|G1|G2   \n",
       "2   HN120  1007  1010      1007  D1|D2|G1|G2   \n",
       "3   HN120  1007   182      1007  D1|D2|G1|G2   \n",
       "4   HN120  1007   301      1007  D1|D2|G1|G2   \n",
       "\n",
       "                                           cluster_p  \\\n",
       "0  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "1  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "2  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "3  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "4  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "\n",
       "                                     cluster_delta_A   delta_A  \\\n",
       "0  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "1  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "2  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "3  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "4  0.056986626834624|-0.5521462503121|0.532688663...  0.187198   \n",
       "\n",
       "                                      cluster_kill_A     kill_A  ...  \\\n",
       "0  49.012625383709|59.452863251762|40.87266962319...  44.327073  ...   \n",
       "1  49.012625383709|59.452863251762|40.87266962319...  44.327073  ...   \n",
       "2  49.012625383709|59.452863251762|40.87266962319...  44.327073  ...   \n",
       "3  49.012625383709|59.452863251762|40.87266962319...  44.327073  ...   \n",
       "4  49.012625383709|59.452863251762|40.87266962319...  44.327073  ...   \n",
       "\n",
       "                                     cluster_delta_B   delta_B  \\\n",
       "0  -2.8334341716821|-2.6720860912117|-3.778959838... -3.028104   \n",
       "1  -4.0213711434516|-3.6385077224033|-3.038971912... -3.319798   \n",
       "2  1.8712695534725|1.0992860185533|3.087297545393...  2.176924   \n",
       "3  -1.690692592809|-1.3450796341807|-0.8269725475... -1.173359   \n",
       "4  -1.5438814859345|-3.2564531480835|-3.508445283... -2.726141   \n",
       "\n",
       "                                      cluster_kill_B     kill_B  \\\n",
       "0  87.69637799287|86.437921582584|93.209818273866...  85.297489   \n",
       "1  94.199124702299|92.56712528151|89.152897129961...  87.040929   \n",
       "2  21.465935078167|31.821936069363|10.52739493194...  17.366424   \n",
       "3  76.348806194752|71.754940580896|63.95043861070...  66.444651   \n",
       "4  74.462298740991|90.526989849554|91.92254116809...  81.894659   \n",
       "\n",
       "                                      cluster_kill_C     kill_C    improve  \\\n",
       "0  93.726706155852|94.500965518187|95.98514681760...  90.008341   4.710851   \n",
       "1  97.042285980937|96.986182123569|93.58639764972...  90.673498   3.632569   \n",
       "2  59.957542116904|72.355747185743|47.09723720467...  53.049766   8.722693   \n",
       "3  87.940877213293|88.547437132715|78.68485673796...  79.552638  13.107986   \n",
       "4  86.97899659068|96.158965620124|95.224014230406...  88.213137   6.318478   \n",
       "\n",
       "  improve_p  kill_entropy  sum_kill_dif  \n",
       "0  0.055228           0.0    169.970362  \n",
       "1  0.041734           0.0    178.638303  \n",
       "2  0.196780           0.0    111.481073  \n",
       "3  0.197277           0.0     91.931882  \n",
       "4  0.077154           0.0    163.355724  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df = pd.concat([drug_combi_pred_df, pd.DataFrame(rows, columns=['cluster_kill_C', 'kill_C', 'improve', 'improve_p', 'kill_entropy', 'sum_kill_dif'])], axis=1)\n",
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:02.818698Z",
     "start_time": "2020-11-17T13:30:02.798727Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>patient</th>\n",
       "      <th>drug_id_A</th>\n",
       "      <th>drug_name_A</th>\n",
       "      <th>drug_id_B</th>\n",
       "      <th>drug_name_B</th>\n",
       "      <th>cluster</th>\n",
       "      <th>cluster_p</th>\n",
       "      <th>cluster_kill_A</th>\n",
       "      <th>cluster_kill_B</th>\n",
       "      <th>cluster_kill_C</th>\n",
       "      <th>kill_A</th>\n",
       "      <th>kill_B</th>\n",
       "      <th>kill_C</th>\n",
       "      <th>improve</th>\n",
       "      <th>improve_p</th>\n",
       "      <th>kill_entropy</th>\n",
       "      <th>sum_kill_dif</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>133</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>87.69637799287|86.437921582584|93.209818273866...</td>\n",
       "      <td>93.726706155852|94.500965518187|95.98514681760...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>85.297489</td>\n",
       "      <td>90.008341</td>\n",
       "      <td>4.710851</td>\n",
       "      <td>0.055228</td>\n",
       "      <td>0.0</td>\n",
       "      <td>169.970362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>201</td>\n",
       "      <td>Epothilone B</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>94.199124702299|92.56712528151|89.152897129961...</td>\n",
       "      <td>97.042285980937|96.986182123569|93.58639764972...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>87.040929</td>\n",
       "      <td>90.673498</td>\n",
       "      <td>3.632569</td>\n",
       "      <td>0.041734</td>\n",
       "      <td>0.0</td>\n",
       "      <td>178.638303</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>1010</td>\n",
       "      <td>Gefitinib</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>21.465935078167|31.821936069363|10.52739493194...</td>\n",
       "      <td>59.957542116904|72.355747185743|47.09723720467...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>17.366424</td>\n",
       "      <td>53.049766</td>\n",
       "      <td>8.722693</td>\n",
       "      <td>0.196780</td>\n",
       "      <td>0.0</td>\n",
       "      <td>111.481073</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>182</td>\n",
       "      <td>Obatoclax Mesylate</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>76.348806194752|71.754940580896|63.95043861070...</td>\n",
       "      <td>87.940877213293|88.547437132715|78.68485673796...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>66.444651</td>\n",
       "      <td>79.552638</td>\n",
       "      <td>13.107986</td>\n",
       "      <td>0.197277</td>\n",
       "      <td>0.0</td>\n",
       "      <td>91.931882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>HN120</td>\n",
       "      <td>1007</td>\n",
       "      <td>Docetaxel</td>\n",
       "      <td>301</td>\n",
       "      <td>PHA-793887</td>\n",
       "      <td>D1|D2|G1|G2</td>\n",
       "      <td>0.31318681318681|0.17582417582418|0.3406593406...</td>\n",
       "      <td>49.012625383709|59.452863251762|40.87266962319...</td>\n",
       "      <td>74.462298740991|90.526989849554|91.92254116809...</td>\n",
       "      <td>86.97899659068|96.158965620124|95.224014230406...</td>\n",
       "      <td>44.327073</td>\n",
       "      <td>81.894659</td>\n",
       "      <td>88.213137</td>\n",
       "      <td>6.318478</td>\n",
       "      <td>0.077154</td>\n",
       "      <td>0.0</td>\n",
       "      <td>163.355724</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  patient drug_id_A drug_name_A drug_id_B         drug_name_B      cluster  \\\n",
       "0   HN120      1007   Docetaxel       133         Doxorubicin  D1|D2|G1|G2   \n",
       "1   HN120      1007   Docetaxel       201        Epothilone B  D1|D2|G1|G2   \n",
       "2   HN120      1007   Docetaxel      1010           Gefitinib  D1|D2|G1|G2   \n",
       "3   HN120      1007   Docetaxel       182  Obatoclax Mesylate  D1|D2|G1|G2   \n",
       "4   HN120      1007   Docetaxel       301          PHA-793887  D1|D2|G1|G2   \n",
       "\n",
       "                                           cluster_p  \\\n",
       "0  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "1  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "2  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "3  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "4  0.31318681318681|0.17582417582418|0.3406593406...   \n",
       "\n",
       "                                      cluster_kill_A  \\\n",
       "0  49.012625383709|59.452863251762|40.87266962319...   \n",
       "1  49.012625383709|59.452863251762|40.87266962319...   \n",
       "2  49.012625383709|59.452863251762|40.87266962319...   \n",
       "3  49.012625383709|59.452863251762|40.87266962319...   \n",
       "4  49.012625383709|59.452863251762|40.87266962319...   \n",
       "\n",
       "                                      cluster_kill_B  \\\n",
       "0  87.69637799287|86.437921582584|93.209818273866...   \n",
       "1  94.199124702299|92.56712528151|89.152897129961...   \n",
       "2  21.465935078167|31.821936069363|10.52739493194...   \n",
       "3  76.348806194752|71.754940580896|63.95043861070...   \n",
       "4  74.462298740991|90.526989849554|91.92254116809...   \n",
       "\n",
       "                                      cluster_kill_C     kill_A     kill_B  \\\n",
       "0  93.726706155852|94.500965518187|95.98514681760...  44.327073  85.297489   \n",
       "1  97.042285980937|96.986182123569|93.58639764972...  44.327073  87.040929   \n",
       "2  59.957542116904|72.355747185743|47.09723720467...  44.327073  17.366424   \n",
       "3  87.940877213293|88.547437132715|78.68485673796...  44.327073  66.444651   \n",
       "4  86.97899659068|96.158965620124|95.224014230406...  44.327073  81.894659   \n",
       "\n",
       "      kill_C    improve  improve_p  kill_entropy  sum_kill_dif  \n",
       "0  90.008341   4.710851   0.055228           0.0    169.970362  \n",
       "1  90.673498   3.632569   0.041734           0.0    178.638303  \n",
       "2  53.049766   8.722693   0.196780           0.0    111.481073  \n",
       "3  79.552638  13.107986   0.197277           0.0     91.931882  \n",
       "4  88.213137   6.318478   0.077154           0.0    163.355724  "
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "drug_combi_pred_df = drug_combi_pred_df[['patient', 'drug_id_A', 'drug_name_A', 'drug_id_B', 'drug_name_B', 'cluster', 'cluster_p', 'cluster_kill_A', 'cluster_kill_B', 'cluster_kill_C', 'kill_A', 'kill_B', 'kill_C', 'improve', 'improve_p', 'kill_entropy', 'sum_kill_dif']]\n",
    "\n",
    "drug_combi_pred_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-17T13:30:03.287793Z",
     "start_time": "2020-11-17T13:30:03.276308Z"
    }
   },
   "outputs": [],
   "source": [
    "if dosage_shifted:\n",
    "    drug_combi_pred_df.to_csv(current_dir + 'pred_combi_kill_{}_{}_shifted.csv'.format(ref_type, model_name), index=False)\n",
    "else:\n",
    "    drug_combi_pred_df.to_csv(current_dir + 'pred_combi_kill_{}_{}.csv'.format(ref_type, model_name), index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
